import '@/style.css'
import javascriptLogo from './javascript.svg'
import viteLogo from '../public/vite.svg'
import { setupCounter } from './counter.js'
// import vue from './vue.vue'
// import vueJsx from './app.jsx'
// import { createApp } from 'vue'
import jpg from './test.jpg'
import scss from './style.module.scss?raw'
import json from './test.json'
console.log('raw数据:', scss)
console.log('json:', json)
console.log('环境变量', import.meta.env)

// 使用glob获取所有文件
const modules = import.meta.glob('./*.js', { eager: false })
console.log('modules:', modules)
for (const path in modules) {
  modules[path]().then((res) => {
    console.log('glob:', res)
  })
}

// let app = null
// let jsx = null
function render() {
  document.querySelector('#other').innerHTML = `
  <div>
    <a href="https://vite.dev" target="_blank">
      <img src="${viteLogo}" class="logo" alt="Vite logo" />
    </a>
    <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript" target="_blank">
      <img src="${javascriptLogo}" class="logo vanilla" alt="JavaScript logo" />
    </a>
    <img src="${jpg}" class="logo vanilla" alt="JavaScript logo" />
    <h1>Hello Vite!</h1>
    <div class="card">
      <button id="counter" type="button"></button>
    </div>
    <span class="read-the-docs span">
      Click on the Vite
    </span>
  </div>
`
}
render()

// 热更新
// if (import.meta.hot) {
//   import.meta.hot.accept((res) => {
//     console.log('热更新1', res)
//   })
// }

setupCounter(document.querySelector('#counter'))
// app = createApp(vue)
// app.mount('#app')

// jsx = createApp(vueJsx)
// jsx.mount('#jsx')
